import { Component } from "react";
import { globalContext } from './global'
class Son2 extends Component {
    changeName1 = (name) => {
        this.context.changeName(name)
       }
    render() {
        return (
            
            <div>
                子组件2<br/>
                姓名{this.context.name}<br/>
                邮箱{this.context.email}
                <button onClick={() => this.changeName1('李四')}>修改全局数据子组件2</button>
                <p>默认插槽====== {  this.props.children }</p>
                具名插槽:footer====
                {
                    this.props.footer
                }
            </div>
        );
    }
}
Son2.contextType = globalContext//*重要

export default Son2